import { resultSuccess, resultError, getRequestToken, requestParams } from '../_util';
import { MockMethod } from 'vite-plugin-mock';

//查看试卷
const reviewPager = {
  path: 'review-paper/:id?',
  name: 'ReviewPaper',
  component: '/exam-info/review-paper/index',
  meta: {
    title: 'routes.management.reviewPager',
    hideMenu: true,
  },
  children: [],
};

// 组织管理
const organization = {
  path: '/organization',
  name: 'organization',
  component: 'LAYOUT',
  redirect: '/organization/teacher-info',
  meta: {
    title: '组织管理',
    hideMenu: false,
    hideChildrenInMenu: false,
    icon: 'mingcute:grid-2-line',
  },
  children: [
    {
      path: 'teacher-info',
      name: 'TeacherInfo',
      component: '/organizationalManagement/teacherInfo/index',
      meta: {
        hideMenu: false,
        title: '教师管理',
        icon: 'ci:dot-05-xl',
      },
    },
    {
      path: 'college-manage',
      name: 'collegeManage',
      component: '/organizationalManagement/collegeManage/index',
      meta: {
        hideMenu: false,
        title: '学院管理',
        icon: 'ci:dot-05-xl',
      },
    },
    {
      path: 'subject-manage',
      name: 'SubjectManage',
      component: '/organizationalManagement/subjectManage/index',
      meta: {
        title: '科目管理',
        icon: 'ci:dot-05-xl',
        hideMenu: false,
      },
    },
    {
      path: 'examination-paper',
      name: 'ExaminationPaper',
      component: '/organizationalManagement/examinationPaper/index',
      meta: {
        title: '考卷信息',
        hideMenu: false,
        hideChildrenInMenu: true,
        icon: 'ci:dot-05-xl',
      },
      children: [
        {
          path: 'examination-testpaper',
          name: 'Examinationestpaper',
          component: '/organizationalManagement/examinationPaper/testpaper',
          meta: {
            title: '试卷详情',
            hideMenu: false,
            icon: 'ci:dot-05-xl',
          },
        },
      ],
    },
  ],
};

// admin 试评管理状态
const stateAdmin = {
  path: 'state',
  name: 'State',
  component: '/management/state/index',
  meta: {
    title: '试评阅卷数据分析',
    hideMenu: false,
    icon: 'ci:dot-05-xl',
  },
  children: [],
};


//评阅管理管理
const managementRoute = {
  path: '/management',
  name: 'Management',
  component: 'LAYOUT',
  redirect: '/management/review-progress',
  meta: {
    title: '评阅管理',
    hideChildrenInMenu: false,
    icon: 'majesticons:paper-fold-text-line',
  },
  children: [
    {
      path: 'review-progress',
      name: 'ReviewProgress',
      component: '/management/reviewProgress/index',
      meta: {
        hideMenu: false,
        hideChildrenInMenu: true,
        title: '评阅进度',
        icon: 'ci:dot-05-xl',
      },
      children: [
        {
          path: 'list',
          name: 'List',
          component: '/management/paper/list',
          meta: {
            currentActiveMenu: '',
            title: '列表',
          },
        },
        {
          path: 'subjecTdetail/:id?',
          name: 'examPapersDetail',
          component: '/management/paper/detail',
          meta: {
            currentActiveMenu: '',
            title: 'routes.management.examPaperDetail',
          },
        },
        {
          path: 'detail-test/:id?',
          name: 'examPapersDetailTest',
          component: '/management/paper/detail-test',
          meta: {
            currentActiveMenu: '',
            title: 'routes.management.examPaperDetail',
          },
        },
        {
          path: 'detail-index/:id?',
          name: 'examPapersDetailIndex',
          component: '/management/paper/detail-index',
          meta: {
            currentActiveMenu: '',
            title: 'routes.management.examPaperDetail',
          },
        },
      ],
    },
    {
      path: 'teacher',
      name: 'TeacherReviewer',
      component: '/management/teacher/index',
      meta: {
        hideMenu: false,
        hideChildrenInMenu: true,
        title: '评阅教师',
        icon: 'ci:dot-05-xl',
        // currentActiveMenu: '/manage',
      },
      children: [
        {
          path: 'detail/:id?',
          name: 'teacherDetail',
          component: '/management/teacher/detail',
          meta: {
            currentActiveMenu: '/management/teacher',
            title: 'routes.management.examPaperDetail',
            hideMenu: true,
          },
        },
      ],
    },
    stateAdmin,
  ],
};

//招办教师首页
const recruitHomeRoute = {
  path: '/home',
  name: 'Home',
  component: 'LAYOUT',
  redirect: '/home/index',
  meta: {
    title: '首页',
    hideChildrenInMenu: true,
    icon: 'bx:bx-home',
  },
  children: [
    {
      path: 'index',
      name: 'indexRecruit',
      component: '/home/index/index-recruit',
      meta: {
        hideMenu: true,
        title: '首页',
        icon: 'bx:bx-home',
        currentActiveMenu: '/home',
      },
      children: [],
    },
  ],
};

// 试卷审核
const examinationPaperAuditRoute = {
  path: '/examination-audit',
  name: 'ExaminationPaperAudit',
  component: 'LAYOUT',
  redirect: '/examination-audit/review-task',
  meta: {
    title: '评阅组长',
    hideChildrenInMenu: false,
    icon: 'heroicons:newspaper',
  },
  children: [
    {
      path: 'review-task',
      name: 'ReviewTask',
      component: '/examination-audit/review-task/index',
      meta: {
        hideMenu: false,
        title: '组长工作台',
        icon: 'ci:dot-05-xl',
      },
    },
    {
      path: 'abnormal-teacher',
      name: 'AbnormalTeacher',
      component: '/examination-audit/abnormal-teacher/index',
      meta: {
        hideMenu: false,
        title: '评阅标准设置（组长）',
        icon: 'ci:dot-05-xl',
      },
    },

    reviewPager,
  ],
};

// 系统管理
const systemManage = {
  path: '/system-manage',
  name: 'SystemManage',
  component: 'LAYOUT',
  redirect: '/system-manage/role-manage',
  meta: {
    title: '系统管理',
    hideChildrenInMenu: false,
    icon: 'icon-park-outline:system',
  },
  children: [
    {
      path: 'permission',
      name: 'Permission',
      component: '/system-manage/permission/index',
      meta: {
        hideMenu: false,
        title: '角色权限管理',
        icon: 'ci:dot-05-xl',
      },
    },
    {
      path: 'account-allocation',
      name: 'AccountAllocation',
      component: '/system-manage/account-allocation/index',
      meta: {
        hideMenu: false,
        title: '管理账号管理',
        icon: 'ci:dot-05-xl',
      },
    },
    {
      path: 'operation-log',
      name: 'operationLog',
      component: '/system-manage/operation-log/index',
      meta: {
        hideMenu: false,
        title: '操作日志管理',
        icon: 'ci:dot-05-xl',
      },
    },
  ],
};
//评阅教师
const reviewRoute = {
  path: '/teacher',
  name: 'teacher',
  component: 'LAYOUT',
  redirect: '/teacher/index',
  meta: {
    title: '评阅教师',
    hideChildrenInMenu: true,
    icon: '',
  },
  children: [
    {
      path: 'index',
      name: 'Index',
      component: '/teacher/home/index',
      meta: {
        hideMenu: true,
        title: '',
        icon: '',
        currentActiveMenu: '',
      },
    },
    {
      path: 'review',
      name: 'Review',
      component: '/teacher/review/index',
      meta: {
        hideMenu: true,
        title: '',
        icon: '',
        currentActiveMenu: '',
      },
    },
  ],
};

// 查分模块
const examineGradeRoute = {
  path: '/examine-grade',
  name: 'ExamineGrade',
  component: 'LAYOUT',
  redirect: '/examine-grade/index',
  meta: {
    hideChildrenInMenu: false,
    title: '评阅统计',
    icon: 'ant-design:file-search-outlined',
  },
  children: [
    {
      path: 'index',
      name: 'ExamineGradeIndex',
      component: '/examineGrade/fraction/index',
      meta: {
        hideMenu: false,
        hideChildrenInMenu: true,
        title: '查询分数',
        icon: 'ci:dot-05-xl',
      },
      children: [
        {
          path: 'fraction-etaile',
          name: 'FractionDetaile',
          component: '/examineGrade/fraction/detaile',
          meta: {
            title: '试卷还原',
            hideMenu: true,
          },
          children: [],
        },
      ],
    },
    {
      path: 'reviewindex',
      name: 'ExamineGradereviewIndex',
      component: '/examineGrade/review/index',
      meta: {
        hideMenu: false,
        hideChildrenInMenu: true,
        title: '正评阅试卷数据',
        icon: 'ci:dot-05-xl',
      },
    },
    {
      path: 'applicationInfoindex',
      name: 'ExamineGradeapplicationInfoIndex',
      component: '/examineGrade/applicationInfo/index',
      meta: {
        hideMenu: false,
        hideChildrenInMenu: true,
        title: '考生报考信息',
        icon: 'ci:dot-05-xl',
      },
    },
    reviewPager,
  ],
};

// 抽检教师 -阅卷信息
const spotCheckExamsRoute = {
  path: '/spot-check-exams',
  name: 'SpotCheckExams',
  component: 'LAYOUT',
  redirect: '/spot-check/exams-info/paper',
  meta: {
    title: '试卷质检',
    icon: 'majesticons:paper-fold-text-line',
  },
  children: [
    {
      path: 'paper',
      name: 'spotCheck-exams-paper',
      component: '/spot-check/exams-info/paper',
      meta: {
        hideMenu: false,
        title: '质检工作台',
        icon: 'ci:dot-05-xl',
      },
    },
    reviewPager,
  ],
};

// 质检教师-异常试卷
const qualityInspectionUntowardRoute = {
  path: '/quality-inspection',
  name: 'qualityInspection',
  component: 'LAYOUT',
  redirect: '/quality-inspection/abnormal-examination-paper',
  meta: {
    title: '异常信息处理',
    hideChildrenInMenu: true,
    icon: 'icon-park-solid:abnormal',
  },
  children: [
    {
      path: 'abnormal-examination-paper',
      name: 'AbnormalExaminaPaper',
      component: '/examination-audit/abnormal-examination-paper/index',
      meta: {
        hideMenu: false,
        title: '异常信息处理',
        icon: 'ci:dot-05-xl',
      },
    },
  ],
};

export default [
  {
    url: '/api/sys/getCurrentM',
    timeout: 1000,
    method: 'get',
    response: (request: requestParams) => {
      const token = getRequestToken(request);
      if (!token) {
        return resultError('Invalid token!');
      }

      let menu: Object[];

      menu = [
        recruitHomeRoute,
        organization,
        managementRoute,
        qualityInspectionUntowardRoute,
        spotCheckExamsRoute,
        examineGradeRoute,
        systemManage,
        examinationPaperAuditRoute,
        reviewRoute,
      ];

      return resultSuccess({ data: menu });
    },
  },
] as MockMethod[];
